package com.lagou;

import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class RabbitApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext configurableApplicationContext = SpringApplication.run(RabbitApplication.class, args);
        /**
         * 默认使用的RabbitListenerContainerFactory就是SimpleRabbitListenerContainerFactory
         */
        SimpleRabbitListenerContainerFactory simpleRabbitListenerContainerFactory = (SimpleRabbitListenerContainerFactory) configurableApplicationContext.getBean(RabbitListenerContainerFactory.class);
        System.out.println(simpleRabbitListenerContainerFactory);
        /**
         * 此时设置已经太晚了
         */
        //simpleRabbitListenerContainerFactory.setConcurrentConsumers(5);
    }

}
